{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "intro",
   "metadata": {},
   "source": [
    "# Introduction to Conditionals in Python"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "concepto",
   "metadata": {},
   "source": [
    "## Step 1: What are conditionals?\n",
    "Conditionals allow a program to make decisions based on certain conditions. They are used to execute different blocks of code depending on whether a condition is `True` or `False`.\n",
    "The most common conditional statements in Python are:"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "tipos-lista",
   "metadata": {},
   "source": [
    "- **`if` statement**: Runs a block of code if a condition is true.\n",
    "- **`if-else` statement**: Runs one block of code if a condition is true, otherwise runs another block.\n",
    "- **`elif` statement**: Checks multiple conditions in sequence.\n",
    "- **Nested conditionals**: Conditionals inside conditionals."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "if-statement",
   "metadata": {},
   "source": [
    "## Step 2: The `if` Statement\n",
    "The `if` statement checks if a condition is true and executes the code inside its block."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "codigo-if",
   "metadata": {},
   "outputs": [],
   "source": [
    "age = 20\n",
    "if age >= 18:\n",
    "    print(\"You are an adult.\")  # Output: You are an adult."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "if-else-statement",
   "metadata": {},
   "source": [
    "## Step 3: The `if-else` Statement\n",
    "If the condition is false, the `else` block will run instead."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "codigo-if-else",
   "metadata": {},
   "outputs": [],
   "source": [
    "age = 16\n",
    "if age >= 18:\n",
    "    print(\"You are an adult.\")\n",
    "else:\n",
    "    print(\"You are a minor.\")  # Output: You are a minor."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "elif-statement",
   "metadata": {},
   "source": [
    "## Step 4: The `elif` Statement\n",
    "Use `elif` to check multiple conditions in order. The first one that is true gets executed."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "codigo-elif",
   "metadata": {},
   "outputs": [],
   "source": [
    "score = 75\n",
    "if score >= 90:\n",
    "    print(\"Grade: A\")\n",
    "elif score >= 80:\n",
    "    print(\"Grade: B\")\n",
    "elif score >= 70:\n",
    "    print(\"Grade: C\")  # Output: Grade: C\n",
    "else:\n",
    "    print(\"Grade: F\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "nested-conditionals",
   "metadata": {},
   "source": [
    "## Step 5: Nested Conditionals\n",
    "A conditional can be inside another conditional, creating nested logic."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "codigo-nested",
   "metadata": {},
   "outputs": [],
   "source": [
    "age = 20\n",
    "has_id = True\n",
    "if age >= 18:\n",
    "    if has_id:\n",
    "        print(\"You can enter.\")  # Output: You can enter.\n",
    "    else:\n",
    "        print(\"You need an ID.\")\n",
    "else:\n",
    "    print(\"You are too young to enter.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ejercicio",
   "metadata": {},
   "source": [
    "## Step 6: Practical Exercise\n",
    "Write a program that asks for a number and checks whether it is positive, negative, or zero."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ejercicio-2",
   "metadata": {},
   "source": [
    "### Exercise 1: Check Positive, Negative, or Zero\n",
    "Write a program that asks the user for a number and checks whether it is positive, negative, or zero."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ejercicio-3",
   "metadata": {},
   "source": [
    "### Exercise 2: Grade Evaluation\n",
    "Write a program that asks the user for a score between 0 and 100, then prints the grade based on the following conditions:\n",
    "- `90` or higher: Grade A\n",
    "- `80` to `89`: Grade B\n",
    "- `70` to `79`: Grade C\n",
    "- Below `70`: Grade F"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ejercicio-4",
   "metadata": {},
   "source": [
    "### Exercise 3: Year Check\n",
    "Write a program that asks the user for a year and checks if it is greater than 1000.\n",
    "Hint: A year is considered valid if it is greater than 1000."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "name": "python",
   "version": "3.x"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
